Use NS_PATTERN_STR instead of compiled regex
#979
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thanks to @bernhardreiter for the suggestion.
Copilot Summary
This pull request refactors how namespace regular expressions are handled throughout the codebase. The main change is the removal of the compiled regex object
NS_PATTERNin favor of using the raw pattern stringNS_PATTERN_STRdirectly, with explicit calls tore.matchorre.searchwhere needed. This simplifies imports and clarifies the use of regex patterns in both the main code and tests.Refactoring of namespace pattern usage:
NS_PATTERNwith the raw pattern stringNS_PATTERN_STRacross modules and tests, ensuring that regex operations usere.matchorre.searchexplicitly. [1] [2] [3] [4] [5] [6]re.match(NS_PATTERN_STR, ...)andre.search(NS_PATTERN_STR, ...)instead of calling methods on the compiled object. [1] [2] [3] [4] [5]Code cleanup:
reinsrc/ssvc/utils/patterns.pyand deleted the now-unused compiledNS_PATTERNobject. [1] [2]These changes make the use of namespace regex patterns more explicit and consistent, reducing confusion and potential errors from mixing pattern strings and compiled regex objects.